﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="purchaseWeekList.aspx.cs"
    Inherits="PeisongWeb.admin.buyerPriceWeekList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagName="top" Src="controls/top.ascx" TagPrefix="uc1" %>
<%@ Register TagName="menu" Src="controls/menu.ascx" TagPrefix="uc2" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>企业周报价表</title>
    <!--#include file="style.inc"-->

    <script src="/app_common/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        var getYearWeek = function(a, b, c) {
            /* 
            date1是当前日期 
            date2是当年第一天 
            d是当前日期是今年第多少天 
            用d + 当前年的第一天的周差距的和在除以7就是本年第几周 
            */
            var date1 = new Date(), date2 = new Date(date1.getFullYear(), 0, 1),
            d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
            return Math.ceil((d + ((date2.getDay() + 1) - 1)) / 7);
        };
        $(function() {
            var w = getYearWeek() - 1;
            $('#w' + w).css('color', 'red');
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:ScriptManager ID="ScriptManager1" runat="server" />
    <uc1:top ID="Top1" runat="server" />
    <uc2:menu ID="Menu1" runat="server" />
    <div id="admin-body">
        <h2 class="section-cms">
            企业周报价表</h2>
        <ext:Panel ID="Panel1" runat="server" Title="企业周报价" BodyStyle="padding:5px 5px 0"
            Width="960" Frame="true" ButtonAlign="Center">
            <Body>
                <div id="admin_edit_content_search">
                    <ul>
                        <li style="width: auto; margin-right: 20px;">
                            <label>
                                企业名称</label>
                            <asp:DropDownList runat="server" ID="ddlCompany" DataTextField="company" DataValueField="companyId">
                            </asp:DropDownList>
                        </li>
                        <li style="width: auto; margin-right: 20px">
                            <label>
                                年份
                            </label>
                            <asp:DropDownList runat="server" ID="ddlYear">
                                <asp:ListItem Value="2010">2010</asp:ListItem>
                                <asp:ListItem Value="2011">2011</asp:ListItem>
                                <asp:ListItem Value="2012">2012</asp:ListItem>
                                <asp:ListItem Value="2013">2013</asp:ListItem>
                                <asp:ListItem Value="2014">2014</asp:ListItem>
                            </asp:DropDownList>
                        </li>
                        <li style="width: auto; margin-right: 10px;">
                            <asp:Button runat="server" ID="btnSearch" Text="搜 索" OnClick="btnSearch_Click" />
                        </li>
                        <li style="width: auto;">
                            <asp:Button runat="server" ID="btnInitWeeklyPrice" Text="初始化周报价体系" OnClick="btnInitWeeklyPrice_Click" />
                        </li>
                    </ul>
                </div>
            </Body>
        </ext:Panel>
        <p>
            &nbsp;</p>
        <div id="admin_list_content">
            <table cellpadding="0" cellspacing="0">
                <tr class="header-row">
                    <th>
                        周
                    </th>
                    <th>
                        开始日期
                    </th>
                    <th>
                        结束日期
                    </th>
                    <th>
                        创建人
                    </th>
                    <th>
                        创建日期
                    </th>
                    <th>
                        审核人
                    </th>
                    <th>
                        审核日期
                    </th>
                    <th style="text-align: center;">
                        操作
                    </th>
                </tr>
                <asp:Repeater ID="rpt_list" runat="server">
                    <ItemTemplate>
                        <tr id="w<%# DataBinder.Eval(Container.DataItem,"week") %>" class='<%# Container.ItemIndex%2==0? "row-alt":"alt"  %>'>
                            <td>
                                第<%# DataBinder.Eval(Container.DataItem,"week") %>周
                            </td>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem,"startTime","{0:yyyy-MM-dd}") %>
                            </td>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem,"endTime","{0:yyyy-MM-dd}") %>
                            </td>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem,"createUserName") %>
                            </td>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem,"inputDt") %>
                            </td>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem,"auditUserName") %>
                            </td>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem,"updatestatusDt") %>
                            </td>
                            <td align="center">
                                <a target="_blank" href='purchaseWeekEdit.aspx?bpwid=<%# DataBinder.Eval(Container.DataItem,"bpwid") %>&action=edit'
                                    style='display: <%# (bool)DataBinder.Eval(Container.DataItem,"isMake")?"inline":"none" %>;'>
                                    查看</a> 
                                    <span style="<%=power>=2?"": "display:none" %>"><a target="_blank" href='purchaseWeekEdit.aspx?bpwid=<%# DataBinder.Eval(Container.DataItem,"bpwid") %>&action=insert'
                                        style='display: <%# (bool)DataBinder.Eval(Container.DataItem,"isMake")?"none":"inline" %>;'>
                                        生成</a> </span>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
        </div>
    </div>
    </form>
</body>
</html>
